home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / virtualdub / VirtualDub-source-1_4d / ClippingControl.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-20  |  14.1 KB  |  434 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    Copyright (C) 1998-2001 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #define f_CLIPPINGCONTROL_CPP
  19.  
  20. #include <windows.h>
  21. #include <commctrl.h>
  22. #include <vfw.h>
  23.  
  24. #include "oshelper.h"
  25.  
  26. #include "ClippingControl.h"
  27. #include "PositionControl.h"
  28.  
  29. extern HINSTANCE g_hInst;
  30.  
  31. static LRESULT APIENTRY ClippingControlWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  32.  
  33. extern const char szClippingControlName[]="birdyClippingControl";
  34.  
  35. typedef struct ClippingControlData {
  36.     HFONT hFont;
  37.     HDRAWDIB hddFrame;
  38.  
  39.     LONG lWidth, lHeight;
  40.     LONG xRect, yRect;
  41.  
  42.     LONG x1,y1,x2,y2;
  43.  
  44.     BOOL fInhibitRefresh;
  45. } ClippingControlData;
  46.  
  47. ATOM RegisterClippingControl() {
  48.     WNDCLASS wc;
  49.  
  50.     wc.style        = 0;
  51.     wc.lpfnWndProc    = ClippingControlWndProc;
  52.     wc.cbClsExtra    = 0;
  53.     wc.cbWndExtra    = sizeof(ClippingControlData *);
  54.     wc.hInstance    = g_hInst;
  55.     wc.hIcon        = NULL;
  56.     wc.hCursor        = NULL;
  57.     wc.hbrBackground= (HBRUSH)(COLOR_3DFACE+1);        //GetStockObject(LTGRAY_BRUSH);
  58.     wc.lpszMenuName    = NULL;
  59.     wc.lpszClassName= CLIPPINGCONTROLCLASS;
  60.  
  61.     return RegisterClass(&wc);
  62. }
  63.  
  64. enum {
  65.     IDC_X1_STATIC    = 500,
  66.     IDC_X1_EDIT        = 501,
  67.     IDC_X1_SPIN        = 502,
  68.     IDC_Y1_STATIC    = 503,
  69.     IDC_Y1_EDIT        = 504,
  70.     IDC_Y1_SPIN        = 505,
  71.     IDC_X2_STATIC    = 506,
  72.     IDC_X2_EDIT        = 507,
  73.     IDC_X2_SPIN        = 508,
  74.     IDC_Y2_STATIC    = 509,
  75.     IDC_Y2_EDIT        = 510,
  76.     IDC_Y2_SPIN        = 511,
  77.     IDC_POSITION    = 512,
  78. };
  79.  
  80. static BOOL CALLBACK ClippingControlInitChildrenProc(HWND hWnd, LPARAM lParam) {
  81.     SendMessage(hWnd, WM_SETFONT, (WPARAM)lParam, (LPARAM)MAKELONG(FALSE, 0));
  82.  
  83.     switch(GetWindowLong(hWnd, GWL_ID)) {
  84.     case IDC_X1_STATIC:        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"X1 offset");
  85.                             break;
  86.     case IDC_Y1_STATIC:        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"Y1 offset");
  87.                             break;
  88.     case IDC_X2_STATIC:        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"X2 offset");
  89.                             break;
  90.     case IDC_Y2_STATIC:        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"Y2 offset");
  91.                             break;
  92.     }
  93.  
  94.     return TRUE;
  95. }
  96.  
  97. static BOOL CALLBACK ClippingControlShowChildrenProc(HWND hWnd, LPARAM lParam) {
  98.     ShowWindow(hWnd, SW_SHOW);
  99.  
  100.     return TRUE;
  101. }
  102.  
  103. static void ClippingControlDrawRect(HWND hWnd, HDC hDC, ClippingControlData *ccd) {
  104.     HPEN hPenOld;
  105.     RECT r;
  106.     HDC hDCReleaseMe = NULL;
  107.  
  108.     if (!hDC) hDC = hDCReleaseMe = GetDC(hWnd);
  109.  
  110.     hPenOld = (HPEN)SelectObject(hDC, GetStockObject(BLACK_PEN));
  111.     Draw3DRect(hDC, ccd->xRect+0, ccd->yRect+0, ccd->lWidth+8, ccd->lHeight+8, FALSE);
  112.     Draw3DRect(hDC, ccd->xRect+3, ccd->yRect+3, ccd->lWidth+2, ccd->lHeight+2, TRUE);
  113.  
  114.     r.left        = ccd->xRect + 4;
  115.     r.right        = ccd->xRect + 4 + ccd->lWidth;
  116.     if (ccd->y1) {
  117.         r.top        = ccd->yRect + 4;
  118.         r.bottom    = ccd->yRect + 4 + ccd->y1;
  119.         FillRect(hDC, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
  120.     }
  121.     if (ccd->y2) {
  122.         r.top        = ccd->yRect + 4 + ccd->lHeight - ccd->y2;
  123.         r.bottom    = ccd->yRect + 4 + ccd->lHeight;
  124.         FillRect(hDC, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
  125.     }
  126.  
  127.     r.top        = ccd->yRect + 4 + ccd->y1;
  128.     r.bottom    = ccd->yRect + 4 + ccd->lHeight - ccd->y2;
  129.     if (ccd->x1) {
  130.         r.left        = ccd->xRect + 4;
  131.         r.right        = ccd->xRect + 4 + ccd->x1;
  132.         FillRect(hDC, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
  133.     }
  134.     if (ccd->x2) {
  135.         r.left        = ccd->xRect + 4 + ccd->lWidth - ccd->x2;
  136.         r.right        = ccd->xRect + 4 + ccd->lWidth;
  137.         FillRect(hDC, &r, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
  138.     }
  139.  
  140.     if (ccd->hddFrame) {
  141.         NMHDR nm;
  142.  
  143.         nm.hwndFrom = hWnd;
  144.         nm.idFrom = GetWindowLong(hWnd, GWL_ID);
  145.         nm.code = CCN_REFRESHFRAME;
  146.  
  147.         SendMessage(GetParent(hWnd), WM_NOTIFY, (WPARAM)nm.idFrom, (LPARAM)&nm);
  148.     }
  149.  
  150.     if (ccd->x1) {
  151.         MoveToEx(hDC, ccd->xRect+3+ccd->x1, ccd->yRect+4, NULL);
  152.         LineTo    (hDC, ccd->xRect+3+ccd->x1, ccd->yRect+3+ccd->lHeight);
  153.     }
  154.     if (ccd->x2) {
  155.         MoveToEx(hDC, ccd->xRect+4+ccd->lWidth-ccd->x2, ccd->yRect+4, NULL);
  156.         LineTo    (hDC, ccd->xRect+4+ccd->lWidth-ccd->x2, ccd->yRect+3+ccd->lHeight);
  157.     }
  158.     if (ccd->y1) {
  159.         MoveToEx(hDC, ccd->xRect+4, ccd->yRect+3+ccd->y1, NULL);
  160.         LineTo    (hDC, ccd->xRect+3+ccd->lWidth, ccd->yRect+3+ccd->y1);
  161.     }
  162.     if (ccd->y2) {
  163.         MoveToEx(hDC, ccd->xRect+4, ccd->yRect+4+ccd->lHeight-ccd->y2, NULL);
  164.         LineTo    (hDC, ccd->xRect+3+ccd->lWidth, ccd->yRect+4+ccd->lHeight-ccd->y2);
  165.     }
  166.  
  167.     DeleteObject(SelectObject(hDC, hPenOld));
  168.  
  169.     if (hDCReleaseMe) ReleaseDC(hWnd, hDCReleaseMe);
  170. }
  171.  
  172. BOOL ClippingControlVerifyParams(HWND hDlg, ClippingControlData *ccd) {
  173.     ccd->x1 = GetDlgItemInt(hDlg, IDC_X1_EDIT, NULL, TRUE);
  174.     ccd->x2 = GetDlgItemInt(hDlg, IDC_X2_EDIT, NULL, TRUE);
  175.     ccd->y1 = GetDlgItemInt(hDlg, IDC_Y1_EDIT, NULL, TRUE);
  176.     ccd->y2 = GetDlgItemInt(hDlg, IDC_Y2_EDIT, NULL, TRUE);
  177.  
  178.     if (ccd->x1<0) {
  179.         SetFocus(GetDlgItem(hDlg, IDC_X1_EDIT));
  180.         MessageBeep(MB_ICONQUESTION);
  181.         return FALSE;
  182.     }
  183.     if (ccd->y1<0) {
  184.         SetFocus(GetDlgItem(hDlg, IDC_Y1_EDIT));
  185.         MessageBeep(MB_ICONQUESTION);
  186.         return FALSE;
  187.     }
  188.     if (ccd->x2<0) {
  189.         SetFocus(GetDlgItem(hDlg, IDC_X2_EDIT));
  190.         MessageBeep(MB_ICONQUESTION);
  191.         return FALSE;
  192.     }
  193.     if (ccd->y2<0) {
  194.         SetFocus(GetDlgItem(hDlg, IDC_Y2_EDIT));
  195.         MessageBeep(MB_ICONQUESTION);
  196.         return FALSE;
  197.     }
  198.  
  199.     return TRUE;
  200. }
  201.  
  202. static LRESULT APIENTRY ClippingControlWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  203.     ClippingControlData *ccd = (ClippingControlData *)GetWindowLong(hWnd, 0);
  204.  
  205.     if ((msg >= CCM__FIRST && msg < CCM__LAST) || msg == WM_SETTEXT) {
  206.         HWND hWndPosition = GetDlgItem(hWnd, IDC_POSITION);
  207.  
  208.         if (hWndPosition)
  209.             return SendMessage(hWndPosition, msg, wParam, lParam);
  210.         else
  211.             return 0;
  212.     }
  213.  
  214.     switch(msg) {
  215.  
  216.     case WM_NCCREATE:
  217.         {
  218.             HDRAWDIB hddFrame=NULL;
  219.  
  220.             if ((GetWindowLong(hWnd, GWL_STYLE) & CCS_FRAME) && !(hddFrame = DrawDibOpen()))
  221.                 return FALSE;
  222.  
  223.             if (!(ccd = new ClippingControlData))
  224.                 return FALSE;
  225.             memset(ccd,0,sizeof(ClippingControlData));
  226.  
  227.             ccd->hddFrame = hddFrame;
  228.  
  229.             SetWindowLong(hWnd, 0, (LONG)ccd);
  230.         } return TRUE;
  231.  
  232.     case WM_CREATE:
  233.         {
  234.             LONG du, duX, duY;
  235.  
  236.             ccd->hFont = CreateFont(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Sans Serif");
  237.  
  238.             du = GetDialogBaseUnits();
  239.             duX = LOWORD(du);
  240.             duY = HIWORD(du);
  241.  
  242.             ccd->xRect = (53*duX)/4;
  243.             ccd->yRect = (14*duY)/8;
  244.  
  245.             CreateWindowEx(0                ,"STATIC"        ,NULL,WS_CHILD | SS_LEFT                            ,( 0*duX)/4, ( 2*duY)/8, (22*duX)/4, ( 8*duY)/8, hWnd, (HMENU)IDC_X1_STATIC    , g_hInst, NULL);
  246.             CreateWindowEx(WS_EX_CLIENTEDGE    , "EDIT"        ,NULL,WS_CHILD | ES_LEFT | ES_NUMBER                ,(23*duX)/4, ( 0*duY)/8, (24*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_X1_EDIT    , g_hInst, NULL);
  247.             CreateWindowEx(WS_EX_CLIENTEDGE    ,UPDOWN_CLASS    ,NULL,WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT    | UDS_SETBUDDYINT, 0, 0,     ( 2*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_X1_SPIN    , g_hInst, NULL);
  248.             CreateWindowEx(0                ,"STATIC"        ,NULL,WS_CHILD | SS_LEFT                            ,( 0*duX)/4, (16*duY)/8, (22*duX)/4, ( 8*duY)/8, hWnd, (HMENU)IDC_Y1_STATIC    , g_hInst, NULL);
  249.             CreateWindowEx(WS_EX_CLIENTEDGE    , "EDIT"        ,NULL,WS_CHILD | ES_LEFT | ES_NUMBER                ,(23*duX)/4, (14*duY)/8, (24*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_Y1_EDIT    , g_hInst, NULL);
  250.             CreateWindowEx(WS_EX_CLIENTEDGE    ,UPDOWN_CLASS    ,NULL,WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT    | UDS_SETBUDDYINT, 0, 0,     ( 2*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_Y1_SPIN    , g_hInst, NULL);
  251.             CreateWindowEx(0                ,"STATIC"        ,NULL,WS_CHILD | SS_LEFT                            ,0         , 0         , (22*duX)/4, ( 8*duY)/8, hWnd, (HMENU)IDC_X2_STATIC    , g_hInst, NULL);
  252.             CreateWindowEx(WS_EX_CLIENTEDGE    , "EDIT"        ,NULL,WS_CHILD | ES_LEFT | ES_NUMBER                ,0         , 0         , (24*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_X2_EDIT    , g_hInst, NULL);
  253.             CreateWindowEx(WS_EX_CLIENTEDGE    ,UPDOWN_CLASS    ,NULL,WS_CHILD | UDS_ALIGNRIGHT    | UDS_SETBUDDYINT, 0, 0,     ( 2*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_X2_SPIN    , g_hInst, NULL);
  254.             CreateWindowEx(0                ,"STATIC"        ,NULL,WS_CHILD | SS_LEFT                            ,0         , 0         , (22*duX)/4, ( 8*duY)/8, hWnd, (HMENU)IDC_Y2_STATIC    , g_hInst, NULL);
  255.             CreateWindowEx(WS_EX_CLIENTEDGE    , "EDIT"        ,NULL,WS_CHILD | ES_LEFT | ES_NUMBER                ,0         , 0         , (24*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_Y2_EDIT    , g_hInst, NULL);
  256.             CreateWindowEx(WS_EX_CLIENTEDGE    ,UPDOWN_CLASS    ,NULL,WS_CHILD | UDS_ALIGNRIGHT    | UDS_SETBUDDYINT, 0, 0,     ( 2*duX)/4, (10*duY)/8, hWnd, (HMENU)IDC_Y2_SPIN    , g_hInst, NULL);
  257.  
  258.             if (GetWindowLong(hWnd, GWL_STYLE) & CCS_POSITION)
  259.                 CreateWindowEx(0,POSITIONCONTROLCLASS,NULL,WS_CHILD                                    ,0,0,0,64,hWnd,(HMENU)IDC_POSITION,g_hInst,NULL);
  260.  
  261.             EnumChildWindows(hWnd, (WNDENUMPROC)ClippingControlInitChildrenProc, (LPARAM)ccd->hFont);
  262.         }
  263.         break;
  264.  
  265.     case WM_DESTROY:
  266.         if (ccd->hddFrame) DrawDibClose(ccd->hddFrame);
  267.         delete ccd;
  268.         SetWindowLong(hWnd, 0, 0);
  269.         break;
  270.  
  271.     case WM_PAINT:
  272.         if (ccd->lWidth && ccd->lHeight) {
  273.             PAINTSTRUCT ps;
  274.             HDC hDC;
  275.  
  276.             hDC = BeginPaint(hWnd, &ps);
  277.             ClippingControlDrawRect(hWnd, hDC, ccd);
  278.             EndPaint(hWnd, &ps);
  279.         }
  280.         break;
  281.  
  282.     case WM_COMMAND:
  283.         switch(LOWORD(wParam)) {
  284.         case IDC_X1_EDIT:
  285.         case IDC_X2_EDIT:
  286.         case IDC_Y1_EDIT:
  287.         case IDC_Y2_EDIT:
  288.             if (!ccd->fInhibitRefresh)
  289.                 if (ClippingControlVerifyParams(hWnd,ccd))
  290.                     ClippingControlDrawRect(hWnd,NULL,ccd);
  291.             break;
  292.         case IDC_POSITION:
  293.             SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(GetWindowLong(hWnd, GWL_ID), HIWORD(wParam)), (LPARAM)hWnd);
  294.             break;
  295.         }
  296.         break;
  297.  
  298.     case WM_NOTIFY:
  299.         {
  300.             NMHDR nm = *(NMHDR *)lParam;
  301.  
  302.             nm.idFrom = GetWindowLong(hWnd, GWL_ID);
  303.             nm.hwndFrom = hWnd;
  304.  
  305.             SendMessage(GetParent(hWnd), WM_NOTIFY, nm.idFrom, (LPARAM)&nm);
  306.         }
  307.         break;
  308.  
  309.     case CCM_SETBITMAPSIZE:
  310.         {
  311.             LONG du, duX, duY;
  312.             HWND hWndItem, hWndPosition;
  313.  
  314.             du = GetDialogBaseUnits();
  315.             duX = LOWORD(du);
  316.             duY = HIWORD(du);
  317.  
  318.             ccd->lWidth = LOWORD(lParam);
  319.             ccd->lHeight = HIWORD(lParam);
  320.  
  321.             SetWindowPos(GetDlgItem(hWnd, IDC_X2_STATIC), NULL, ccd->xRect + ccd->lWidth + 8 - (48*duX)/4, (2*duY)/8, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
  322.             SetWindowPos(GetDlgItem(hWnd, IDC_X2_EDIT  ), NULL, ccd->xRect + ccd->lWidth + 8 - (24*duX)/4, (0*duY)/8, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
  323.             SetWindowPos(GetDlgItem(hWnd, IDC_Y2_STATIC), NULL, ( 0*duX)/4, ccd->yRect + 8 + ccd->lHeight - ( 9*duY)/8, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
  324.             SetWindowPos(GetDlgItem(hWnd, IDC_Y2_EDIT  ), NULL, (24*duX)/4, ccd->yRect + 8 + ccd->lHeight - (10*duY)/8, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
  325.  
  326.             if (hWndPosition = GetDlgItem(hWnd, IDC_POSITION))
  327.                 SetWindowPos(hWndPosition, NULL, 0, ccd->yRect + ccd->lHeight + 8, ccd->xRect + ccd->lWidth + 8, 64, SWP_NOZORDER | SWP_NOACTIVATE);
  328.  
  329.             SendMessage(GetDlgItem(hWnd, IDC_X1_SPIN), UDM_SETRANGE, 0, (LPARAM)MAKELONG(ccd->lWidth,0));
  330.             SendMessage(GetDlgItem(hWnd, IDC_Y1_SPIN), UDM_SETRANGE, 0, (LPARAM)MAKELONG(0,ccd->lHeight));
  331.  
  332.             hWndItem = GetDlgItem(hWnd, IDC_X2_SPIN);
  333.             SendMessage(hWndItem, UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_X2_EDIT), 0);
  334.             SendMessage(hWndItem, UDM_SETRANGE, 0, (LPARAM)MAKELONG(ccd->lWidth,0));
  335.  
  336.             hWndItem = GetDlgItem(hWnd, IDC_Y2_SPIN);
  337.             SendMessage(hWndItem, UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_Y2_EDIT), 0);
  338.             SendMessage(hWndItem, UDM_SETRANGE, 0, (LPARAM)MAKELONG(ccd->lHeight,0));
  339.  
  340.             EnumChildWindows(hWnd, (WNDENUMPROC)ClippingControlShowChildrenProc, (LPARAM)ccd->hFont);
  341. //            RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
  342.             SetWindowPos(hWnd, NULL, 0, 0, ccd->xRect + ccd->lWidth + 8, (hWndPosition?64:0) + ccd->yRect + ccd->lHeight + 8, SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS);
  343.         }
  344.         break;
  345.  
  346.     case CCM_SETCLIPBOUNDS:
  347.         {
  348.             ClippingControlBounds *ccb = (ClippingControlBounds *)lParam;
  349.  
  350.             ccd->x1 = ccb->x1;
  351.             ccd->y1 = ccb->y1;
  352.             ccd->x2 = ccb->x2;
  353.             ccd->y2 = ccb->y2;
  354.  
  355.             ccd->fInhibitRefresh = TRUE;
  356.             SetDlgItemInt(hWnd, IDC_X1_EDIT, ccd->x1, FALSE);
  357.             SetDlgItemInt(hWnd, IDC_Y1_EDIT, ccd->y1, FALSE);
  358.             SetDlgItemInt(hWnd, IDC_X2_EDIT, ccd->x2, FALSE);
  359.             SetDlgItemInt(hWnd, IDC_Y2_EDIT, ccd->y2, FALSE);
  360.             ClippingControlDrawRect(hWnd, NULL,ccd);
  361.             ccd->fInhibitRefresh = FALSE;
  362.         }
  363.         break;
  364.  
  365.     case CCM_GETCLIPBOUNDS:
  366.         {
  367.             ClippingControlBounds *ccb = (ClippingControlBounds *)lParam;
  368.  
  369.             ccb->x1 = ccd->x1;
  370.             ccb->y1 = ccd->y1;
  371.             ccb->x2 = ccd->x2;
  372.             ccb->y2 = ccd->y2;
  373.         }
  374.         break;
  375.  
  376.     case CCM_BLITFRAME:
  377.         {
  378.             HDC hDC;
  379.  
  380.             if (hDC = GetDC(hWnd)) {
  381.  
  382.                 if (!wParam) {
  383.                     RECT r;
  384.  
  385.                     r.left        = ccd->xRect + 4;
  386.                     r.top        = ccd->yRect + 4;
  387.                     r.right        = ccd->xRect + 4 + ccd->lWidth;
  388.                     r.bottom    = ccd->yRect + 4 + ccd->lHeight;
  389.                     FillRect(hDC, &r, (HBRUSH)GetClassLong(hWnd,GCL_HBRBACKGROUND));
  390.                 } else {
  391.                     BITMAPINFOHEADER *dcf = (BITMAPINFOHEADER *)wParam;
  392.                     LONG dx = ccd->lWidth  - ccd->x1 - ccd->x2;
  393.                     LONG dy = ccd->lHeight - ccd->y1 - ccd->y2;
  394.  
  395. #if 0
  396.                     static char buf[256];
  397.  
  398. wsprintf(buf, "DrawDibDraw(%08lx, %08lx, %ld, %ld, %ld, %ld, %08lx, %08lx, %ld, %ld, %ld, %ld, %ld)\n",
  399.                                 ccd->hddFrame,
  400.                                 hDC,
  401.                                 ccd->xRect + 4 + ccd->x1, ccd->yRect + 4 + ccd->y1,
  402.                                 dx,dy,
  403.                                 dcf,
  404.                                 (void *)lParam,
  405.                                 ccd->x1, ccd->y1, 
  406.                                 dx,dy,
  407.                                 0);
  408. OutputDebugString(buf);
  409. #endif
  410.                     if (dx>0 && dy>0) {
  411.                         DrawDibDraw(
  412.                                 ccd->hddFrame,
  413.                                 hDC,
  414.                                 ccd->xRect + 4 + ccd->x1, ccd->yRect + 4 + ccd->y1,
  415.                                 dx,dy,
  416.                                 dcf,
  417.                                 (void *)lParam,
  418.                                 ccd->x1, ccd->y1, 
  419.                                 dx,dy,
  420.                                 0);
  421.                     }
  422.                 }
  423.  
  424.                 ReleaseDC(hWnd, hDC);
  425.             }
  426.         }
  427.         break;
  428.  
  429.     default:
  430.         return DefWindowProc(hWnd, msg, wParam, lParam);
  431.     }
  432.     return FALSE;
  433. }
  434.